package com.liao.badminton.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.liao.badminton.code.*;
import com.liao.badminton.dto.ApplyJoinGroupDto;
import com.liao.badminton.dto.UserGroupRefDto;
import com.liao.badminton.entity.JoinGroupApply;
import com.liao.badminton.entity.UserGroupRef;
import com.liao.badminton.vo.StatVo;
import com.liao.badminton.vo.SystemUsersVo;
import com.liao.badminton.vo.UserGroupRefVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

/**
* @author liaocheng
* @date 2024-10-30
* description:群表
*/
public interface UserGroupRefService  extends IService<UserGroupRef> {
	/**
     * 新增
     */
	 ResponseRest saveUserGroupRef(UserGroupRefDto param)throws ProjectException;
	/**
     * 修改
     */
	 ResponseRest updateUserGroupRef(UserGroupRefDto param)throws ProjectException;
	/**
     * 查询列表
     */
	 ResponseRest findUserGroupRefByPageParam(PageParam<UserGroupRefDto> PageParam)throws ProjectException;
    /**
    * 查询详情
    */
    ResponseRest findDetail(UserGroupRefDto param)throws ProjectException;
	/**
     * 删除
     */
	 ResponseRest deletesUserGroupRef(UserGroupRefDto param)throws ProjectException;

	ResponseRest findOneCurrentIdGroupId(UserGroupRefDto param) throws ProjectException;

	/**
	 * @Description: findUserGroupRef 
	 * @Param: 群id和用户名查询群 -新增的时候用
	 * @return:
	 * @Date: 2024/11/5 
	 */ 
	 
	UserGroupRef findUserGroupRefByGidUName(UserGroupRefDto param) throws ProjectException;

	void updateByGroupIdAndUserName(UserGroupRefDto param)throws ProjectException;

    List<UserGroupRef> findByIds(List<Long> collect);

    List<StatVo> findUserRankListByGroupId(Long groupId,Integer orderByType, Integer orderByTypeDesc, String teamOneName);

    ResponseRest<Boolean> setManager(UserGroupRefDto param);

	ResponseRest applyJoinGroup(ApplyJoinGroupDto param);

	ResponseRest findApplyJoinGroupList(PageParam<JoinGroupApply> body);
	ResponseRest joinAppHandle(Long id, Integer status);


	/**
	* @Description: findUserGroupRefByUserId
	* @Param: 登录时用户id查询默认的登录群
	* @return:
	* @Date: 2024/11/5
	*/
//	List<UserGroupRefVo> findUserGroupRefByUserId(Long userId);

//	void  handlerLoginRef(SystemUsersVo systemUsersVo,UserDetails jwtUser);

	/**
	 * 统计用户所以数据
	 * @return
	 */
	ResponseRest<StatVo> allStat(Long groupId);

    List<String> findUserNamesByGroupId(Long groupId);

    void updateActivityNum(List ids, int updateNum);

    void updateCost(List<Long> userGId);
}
